﻿#include "stdafx.h"
#include <iostream>

#include <time.h>   
#include <ctime>
#include <stdio.h>      
#include <stdlib.h>   

using namespace std;


void quickSort(int* s_arr, int first, int last)
{
    int i = first, j = last, x = s_arr[(first + last) / 2];
 
    do {
        while (s_arr[i] < x) i++;
        while (s_arr[j] > x) j--;
 
        if(i <= j) {
            if (i < j) swap(s_arr[i], s_arr[j]);
            i++;
            j--;
        }
    } while (i <= j);
 
    if (i < last)
        quickSort(s_arr, i, last);
    if (first < j)
        quickSort(s_arr, first,j);
}